<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="/pub/head_bootstrap.inc"%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=7" />
<title>${basePageTitle}</title>
</head>

<body class="FrameRightBg">
	<div class="FrameRight" id="FrameRightContent">
		<div class="FrameRightInner fxts-default">
			<div class="location">
				<div class="inner">
					<i class="fa fa-map-marker"></i>
					<a href="###">基础管理</a><span>&gt;</span><a href="###">接口管理</a><span>&gt;</span>
					<a href="${baseURL}/jdbc/common/basecommonlist/list.do?mdId=2af54484a7784d17b566af4eee8eb4d4">外网信息</a><span>&gt;</span><a href="###">查看权限</a>
				</div>
				<!-- inner -->
			</div>
			<!-- location -->
			<div class="main">
				<div class="common-menu">
					<form id="formsearch" method="post">
						<div class="selector-form"></div> 
					</form> 
                   	</div>
					<div class="common-option">
					<div class="inner">
						<button class="btn btn-icon" onclick="add()"><i class="icon iconfont icon-icon-plus"></i>添加</button>
						<button class="btn btn-icon" onclick="RiskNetOpinion.deleteByIds()"><i class="icon iconfont icon-icon-edit"></i>删除</button>
					</div>
				</div>
				<!-- common-menu -->
	
				<div class="common-table">
				    <table id="tb_riskNetOpinion"></table>
				</div>
			</div>
			<!-- main end -->
		</div>
		<!-- FrameRightInner -->
	</div>
<%@ include file="interfacepermissionedit_editByNetId.jsp"%>
<%@ include file="/web/common/selector/selector_form.jsp" %>
<script type="text/javascript">
RiskNetOpinion = {
	initTable: function(){
		$('#tb_riskNetOpinion').bootstrapTable({
			url: "${baseURL}/intermanage/interfacepermission/interfacepermissionlist/listJSON.do",  
    		sidePagination: "server",
       		dataType:'json',
       		dataField: 'Rows',
       		totalField: 'Total',
       		contentType:'application/x-www-form-urlencoded',
       		queryParamsType:"undefined",
       		queryParams:RiskNetOpinion.queryParams,
            striped: true,                      //是否显示行间隔色
            pagination: true,
   	        pageNumber:1,                       //初始化加载第一页，默认第一页
            pageSize: 15,                       //每页的记录行数（*）
            pageList: [20, 50, 100],        //可供选择的每页的行数（*）
   	        clickToSelect: true,                //是否启用点击选中行
            uniqueId: "id",                     //每一行的唯一标识，一般为主键列
       		columns: [{
 	               field: 'checkbox',
	 	           checkbox: true
	           },{
                   field: 'number',
                   title: '序号',
   	               formatter: function (value, row, index) {
   	                   return (index+1);  
   	               }
               },{
	        	   field: 'interfaceId',
	           },  {
                   field: 'name',
                   title: '接口名称',
               },{
                   field: 'interfaceDetail',
                   title: '接口描述'
			   },{
                   field: 'status',
                   title: '接口使用状态',
                   formatter: function (value, row, index) {
						for(var i=0;i<interface_status.length;i++){
							if(interface_status[i].id==value){
								return interface_status[i].text;
							}
						}
						return '未知';
                   }
			   },
			   {
                   field: 'belong_sys',
                   title: '所属系统',
                   formatter: function (value, row, index) {
   	            	 	for(var i=0;i<Subordinate_System.length;i++){
   	            	 		if(Subordinate_System[i].id==value){
   	            	 			return Subordinate_System[i].text;
   	            	 		}
   	            	 	}
   	            	 	return '未知';
   	               }
			   },{
                   field: 'type',
                   title: '接口交互类型',
                   formatter: function (value, row, index) {
   	            	 	for(var i=0;i<respon_type.length;i++){
   	            	 		if(respon_type[i].id==value){
   	            	 			return respon_type[i].text;
   	            	 		}
   	            	 	}
   	            	 	return '未知';
   	               }
   	              },{
                   field: 'interCreator',
                   title: '创建人'
			   }]
		})
	},
	main: function(){
		var _this = RiskNetOpinion;
		_this.initTable();
		 $('#tb_riskNetOpinion').bootstrapTable('hideColumn', 'interfaceId');
	},
	//删除
	deleteByIds: function(){
		var selections = $("#tb_riskNetOpinion").bootstrapTable('getSelections');
		if(selections.length>0){
			BT.showConfirm("删除","你确定删除所选信息吗？",function(){
				var ids = "";
				for(var i=0; i<selections.length; i++){
					ids = ids + selections[i].id + ",";
				}
				ids = ids.substring(0,ids.length-1);
				$.ajax({
					type: "POST",
					url:"${baseURL}/intermanage/interfacepermission/interfacepermissiondelete/delete.do",
					dataType:'json',
					data:{ids:ids},
					success:function(data){
						if(data && data.hasOk == true){
							BT.showSuccess("删除成功!",function(){
								$("#tb_riskNetOpinion").bootstrapTable("refresh");
							});
						}else{
							BT.showError("操作出错!"+data.message);
						}
					}
				})
			}) 
		}else{
			BT.showWarning("请至少选中一行！"); 
		}
	},
	queryParams:function(params){
		return{
			netId:netId,
			perPageSize: params.pageSize,
			pageNo:params.pageNumber,
	    }
	}
};
var netId='${id}';
var interface_status=${interface_status};
var respon_type=${respon_type};
var Subordinate_System = ${Subordinate_System};
$(function () {
	RiskNetOpinion.main();
});

</script>

	<script type="text/javascript">
			//初始化搜索表单
			initData($(".selector-form"),
					[
						{id:"status",name:"使用状态",value:null,valueText:"全部",isExtended:false,selectType:0},
						{id:"type",name:"交互类型",value:null,valueText:"全部",isExtended:false,selectType:0},
						{id:"name",name:"接口名称",value:null,valueText:"全部",isExtended:false,selectType:1,}	
					],"");
				
			      setSearchContainer("status","使用状态",interface_status); 
			      setSearchContainer("type","交互类型",respon_type); 
			
				$(function(){
					renderSelector(getCurrentSelector());
					initSearchGrid($("#tb_riskNetOpinion"),'${baseURL}/intermanage/interfacepermission/interfacepermissionlist/listJSON.do');
				});
	</script>

</body>
</html>
